#include <iostream>
#include <iomanip>

int calc(int x)
{
	if (x <= 1) return x;
	int tmp = calc(x/2);
	if (x & 1) tmp += calc(int(x/2) + 1);
	return tmp;
}

int f[444];

int cc(int x)
{
	if (f[x]) return f[x];
	if (x <= 9) return 1;
	return f[x] = 2*cc(x-3) + 2*cc(x-6) + cc(x-7);
}

int main()
{
	int n = 400;
	std::cout << "-->" << cc(n) << '\n';
	return 0;
	for (int i = 0; i < n; i++)
		 std::cout << ">" << std::setw(4) << i << ":   " << calc(i) << '\n';
}

